home *** CD-ROM | disk | FTP | other *** search
/ Software Vault: The Gold Collection / Software Vault - The Gold Collection (American Databankers) (1993).ISO / cdr11 / pdox693.zip / TI505.ASC < prev    next >
Text File  |  1992-08-12  |  3KB  |  133 lines

  1.  
  2.  
  3.  
  4.  
  5.  
  6.  
  7.  
  8.   PRODUCT  :  Paradox                                NUMBER  :  505
  9.   VERSION  :  All
  10.        OS  :  DOS
  11.      DATE  :  August 12, 1992                          PAGE  :  1/2
  12.  
  13.     TITLE  :  USING THE SUM OPERATOR WITH CALCULATED FIELDS
  14.  
  15.  
  16.  
  17.  
  18.   The result of a calculated field that involves multiplication can
  19.   vary depending on how you express that calculation.  Consider the
  20.   following table to be sample data.
  21.  
  22.  
  23.     ORDERS=*Cust ID=*===Date==*=Part #=*=Quantity=*=@ Price=*
  24.          1 |  10000 | 7/01/88 |  93821 |     10   |   5.99  |
  25.          2 |  10000 | 7/01/88 |  18281 |      7   |    .99  |
  26.          3 |  10000 | 7/01/88 |  77443 |    100   |  15.89  |
  27.          4 |  12550 | 7/01/88 |  77322 |      5   |   1.55  |
  28.          5 |  12550 | 7/01/88 |  44532 |      1   |  25.99  |
  29.          6 |  13920 | 8/10/88 |  11112 |     82   |   3.54  |
  30.  
  31.  
  32.   Using the table above to calculate the SUM of the Quantity field
  33.   times the @ Price field can be accomplished with either of the
  34.   equations shown below.
  35.  
  36.        Equation 1 = Sum([Quantity]) * Sum([@ Price])
  37.  
  38.        Equation 2 = Sum([Quantity] * [@ Price])
  39.  
  40.   Equation 1 produces the answer $ 11,059.75 by taking the sum of
  41.   the Quantity field for all records, which is 205, and then
  42.   multiplying that by 53.95, which is the sum of the @ price field
  43.   for all records.
  44.  
  45.   The following chart shows the work that Paradox does to process
  46.   equation one.
  47.  
  48.        Record    Quantity    @ Price_
  49.            1         10         5.99
  50.            2          7          .99
  51.            3        100        15.89
  52.            4          5         1.55
  53.            5          1        25.99
  54.                  +   82__   +   3.54_
  55.                     205   *    53.95  =  $ 11,059.75  <- Result
  56.  
  57.  
  58.  
  59.  
  60.  
  61.  
  62.  
  63.  
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70.  
  71.  
  72.  
  73.  
  74.   PRODUCT  :  Paradox                                NUMBER  :  505
  75.   VERSION  :  All
  76.        OS  :  DOS
  77.      DATE  :  August 12, 1992                          PAGE  :  2/2
  78.  
  79.     TITLE  :  USING THE SUM OPERATOR WITH CALCULATED FIELDS
  80.  
  81.  
  82.  
  83.  
  84.   Equation 2 produces the answer $ 1,979.85 by taking the Quantity
  85.   field times the @ Price field for each record and then summing
  86.   all of those results.
  87.  
  88.   The following chart shows the work that Paradox does to process
  89.   equation two.
  90.  
  91.        Record    Quantity   @ Price     Calculated_
  92.            1         10   *   5.99   =       59.90
  93.            2          7   *    .99   =        6.93
  94.            3        100   *  15.89   =     1589.00
  95.            4          5   *   1.55   =        7.75
  96.            5          1   *  25.99   =       25.99
  97.            6         82   *   3.54   =  +   290.28_
  98.                                         $ 1,979.85   <- Result
  99.  
  100.   The final result produced by each equation is completely
  101.   different, however, both final results are correct!
  102.  
  103.   DISCLAIMER: You have the right to use this technical information
  104.   subject to the terms of the No-Nonsense License Statement that
  105.   you received with the Borland product to which this information
  106.   pertains.
  107.  
  108.  
  109.  
  110.  
  111.  
  112.  
  113.  
  114.  
  115.  
  116.  
  117.  
  118.  
  119.  
  120.  
  121.  
  122.  
  123.  
  124.  
  125.  
  126.  
  127.  
  128.  
  129.  
  130.  
  131.  
  132.  
  133.